'''
n = 0  # 判断条件
while n < 5:
    print("hello world")
    n += 1  # 判断条件更新
'''
# for i in range(5):  # range(0, 5, 1) 左闭右开  0 1 2 3 4
#     print("hello")
#
# l1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
# l2 = list(range(10))
# print(l2)  # 左闭右开 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

print("===============================================================")
# result = 0
# for i in range(101):
#     result += i
# print(result)

print("===============================================================")
# 阶乘 1! + 2! + 3! + ... + n!
# n! = (n-1)! * n
# 1.计算n的阶乘
# 2.对所有阶乘求和
# n = int(input("请输入："))
# result = 0
# temp = 1
# for i in range(1, n + 1):  # 1  2
#     temp *= i  # temp = temp * 1
#     result += temp  # result = result + temp
#     print(result)

# n = 4
# result = 0
# for j in range(1, n + 1):
#     temp = 1
#     for i in range(1, j + 1):
#         temp *= i
#         # print(temp)
#     result += temp
#     print(result)

n = 1
result = 0
while n <= 4:
    temp = 1
    m = 1
    while m <= n:
        temp *= m
        m += 1
    result += temp
    print(result)
    n += 1